package com.dishdex.menuhub.module.module.user.mapper;

import com.dishdex.menuhub.module.module.user.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigInteger;
import java.util.List;

/**
* ClassName: 
* Package: com.dishdex.menuhub.module.module.user.mapper
* Description:
* @Author:
* @Create 2025/10/22 9:49
* @Version 1.0
*/
@Mapper
public interface UserMapper {

    @Select("select * from user where id=#{id} and is_deleted=0")
    User getById(@Param("id") Long id);

    @Select("select * from user where id=#{id}")
    User extractById(@Param("id") Long id);

    Long update(@Param("user") User user);

    Long insert(@Param("user") User user);

    @Update("update user set is_deleted=1 where id={id} and is_deleted=0")
    int delete(@Param("id") Long id);

    @Select("select * from user")
    List<User> getAll();

    @Select("select * from user where phone=#{phone}")
    User getByPhone(@Param("phone") String phone);
}
